<?php

namespace apiend\modules\download;

use Yii;
use apiend\components\CModule;
use common\helpers\ArrayHelper;
use yii\rest\Action;

/**
 * 下载服务模块
 *
 * @author emhome <emhome@163.com>
 * @since 1.0
 */
class Module extends CModule {

    /**
     * @param Action $action
     * @return bool whether the action should continue to be executed.
     */
    public function beforeAction($action) {
        if (!parent::beforeAction($action)) {
            return false;
        }
        $controller = $action->controller;
        $controller->exposeHeaders = ArrayHelper::merge($controller->exposeHeaders, [
            'Content-Disposition'
        ]);
        return true;
    }

}
